import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    num:0
  },
  getters: {
  },
  mutations: {
    addNum(state){
      state.num ++;
    },
    reduceNum(state){
      state.num--;
    }
  },
  actions: {
    addTimeNum(content){
      setTimeout(function(){
        content.commit('addNum');
      },2000)
    },
    reduceTimeNum(content){
      setTimeout(function(){
        content.commit('reduceNum');
      },2000)
    }
  },
  modules: {
  }
})
